<template>
	<view class="home-content">
		<view class="detail-block">
			<view class="title">{{detail.title}}</view>
			<mp-html :content="detail.content" v-if="detail.content"></mp-html>
			<view style="text-align: center;" v-else>暂无详情</view>
		</view>
	</view>
</template>

<script>
	import {
		getBuildDetailApi
	} from '@/api/community.js'
	export default {
		data() {
			return {
				id: 0,
				detail: {
					content: '',
					title: ''
				}
			}
		},
		methods: {
			getDetailApi() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				const id = this.id
				getBuildDetailApi(id).then(data => {
					uni.hideLoading()
					this.detail = data[0]
				}).catch(() => {
					uni.hideLoading()
				})
			}
		},
		onLoad(e) {
			this.id = e.id
			this.getDetailApi()
		}
	}
</script>

<style lang="scss" scoped>
	.home-content {
		overflow: hidden;
		padding: 30rpx;

		.detail-block {
			min-height: 100vh;
			position: relative;
			margin: 0 auto;
			padding: 30rpx;
			background: #fff;
			border-radius: 12rpx;
			box-shadow: 0 0 10px 0px #e8e8e8;
			margin-bottom: 30rpx;
			line-height: 2;
			font-size: 28rpx;
			text-align: justify;
			text-indent: 56rpx;

			.title {
				text-align: center;
				font-size: 34rpx;
				margin-bottom: 30rpx;
			}
		}
	}
</style>